$("#form-order-addFollow").validate({
	rules:{
		xxxx:{
			required:true,
		},
	},
	submitHandler:function(form){
		addFollow();
	}
});

//function add() {
//    _ajax_save(ctx + "module/order/save", $('#form-order-addFollow').serialize());
//}

function addFollow() {
	var status = $("input[name='status']").val();
	var recordId = $("input[name='recordId']").val();
	var typeId = $("input[name='typeId']").val();
	var visitType = $("select[name='visitType'] option:selected").text();
	var year = $("select[name='year']").find("option:selected").text().replace(/年/,'');
	var month = $("select[name='month']").find("option:selected").text().replace(/月/,'');
	var day = $("select[name='day']").find("option:selected").text().replace(/日/,'');	
	var visitTime = year+"-"+month+"-"+day;	
	var visitRecord = $("textarea[name='visitRecord']").val();
	var visitRemark = $("textarea[name='visitRemark']").val();
	var year2 = $("select[name='year2']").find("option:selected").text().replace(/年/,'');
	var month2 = $("select[name='month2']").find("option:selected").text().replace(/月/,'');
	var day2 = $("select[name='day2']").find("option:selected").text().replace(/日/,'');	
	var visitTimeNest = year2+"-"+month2+"-"+day2;	
	var orderId = $("input[name='orderId']").val();
	var orderNum = $("input[name='orderNum']").val();
	var serviceUserId = $("input[name='serviceUserId']").val();
	var salesUserId = $("input[name='salesUserId']").val();
	var createTime = $("input[name='createTime']").val();
	var deptId = $("input[name='deptId']").val();
	var visitId = $("input[name='visitId']").val();
	var visitStatus = $("input[name='visitStatus']").val();	
	if(year==''||year=='-请选择年份-'){
		layer.msg("请选择拜访时间年份");
		return false;
	}else if(month==''||month=='-请选择月份-'){
		layer.msg("请选择拜访时间月份");
		return false;
	}else if(day==''||day=='-请选择日期-'){
		layer.msg("请选择拜访时间日期");
		return false;
	}
	if(year2==''||year=='-请选择年份-'){
		visitTimeNest='';
	}else if(month2==''||month=='-请选择月份-'){
		visitTimeNest='';
	}else if(day2=='-请选择日期-'){
		visitTimeNest='';
	}
	$.ajax({
		cache : true,
		type : "POST",
		url : ctx + "module/order/followAdd",
		data : {
			"status":status,
			"recordId":recordId,
			"typeId":typeId,
			"visitType":visitType,
			"visitTime":visitTime,
			"visitRecord":visitRecord,
			"visitRemark":visitRemark,
			"visitTimeNest":visitTimeNest,	
			"orderId": orderId,
			"orderNum": orderNum,
			"serviceUserId": serviceUserId,
			"salesUserId": salesUserId,
			"createTime": createTime,
			"deptId": deptId,
			"visitId": visitId,
			"visitStatus": visitStatus,
		},
		async : false,
		error : function(request) {
			$.modalAlert("系统错误", "error");
		},
		success : function(data) {
			if (data.code != 0) {
				parent.layer.msg("新增成功,正在刷新数据请稍后……",{icon:1,time: 500,shade: [0.1,'#fff']},function(){
					$.parentReload();
				});
			} else {
				$.modalAlert(data.msg, "error");
			}

		} 
	});
}